package Class_03_29;


//super 使用三种方法
// super.name [直接调用名称] /
// super.shout() [直接调用方法] /
// super(name, age) [调用构造方法]
class Animal3
{
    private String name;
    private int age;

    public Animal3() {
    }

    public Animal3(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void shout()
    {
        System.out.println("动物叫声为");
    }
}


class Dog extends Animal3
{
    private String color;

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Dog() {
    }

    public Dog(String name, int age, String color) {
        super(name, age);
        this.color = color;
    }

    public void shout()//方法重写
    {
        super.shout();
        System.out.println("汪汪汪..." + super.getName());
    }
    public void PrintName()
    {
        System.out.println(super.getName() + super.getAge() + getColor());
    }
}

public class AnimalTest3 {
    public static void main(String[] args) {
        Dog dog = new Dog("旺财",29,"black");
        dog.PrintName();
        dog.shout();
    }
}
